//
//  alreadyTasksTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/21.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class alreadyTasksTableViewCell: UITableViewCell {
    
    var NumberLabel:UILabel!
    
    var StateLabel:UILabel!
    
    var NameLabel:UILabel!
    
    
    var TimeLabel:UILabel!
    
    var StateButton:UIButton!
    
    var PassButton:UIButton!
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
//    cell.alreadyTasksWithModel(model: cellModel)
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
    
    //     cell.ConversationingWithModel(model: cellModel)
    func alreadyTasksWithModel(model: alreadyTasksModel) {

        NumberLabel.text = model.projectNum
        StateLabel.text = model.taskName
        NameLabel.text = "项目名称:\(model.projectName!)"
         TimeLabel.text = model.createTime
        
    }
    func lauoutUI(){
        
        
        NumberLabel = UILabel()
        
        
        NumberLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        self.contentView.addSubview(self.NumberLabel!)
        
        
        StateLabel = UILabel()
        
        
        StateLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        StateLabel.textAlignment = .right
        self.contentView.addSubview(self.StateLabel!)
        
        NameLabel = UILabel()
        NameLabel.backgroundColor = UIColor.groupTableViewBackground
        NameLabel.textAlignment = .left
        
        NameLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        
        self.contentView.addSubview(self.NameLabel!)
        
        TimeLabel = UILabel()
       
        TimeLabel.textAlignment = .left
        
        TimeLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        TimeLabel.backgroundColor = UIColor.groupTableViewBackground
        self.contentView.addSubview(self.TimeLabel!)
        
        
        
        

        
        
        PassButton = UIButton(type: UIButtonType.roundedRect)
        PassButton.setTitle("进度查询", for: .normal)
        
        PassButton.titleLabel?.textColor = UIColor.black
        //字体
        PassButton.titleLabel?.font = UIFont.systemFont(ofSize: 12)
        //设置圆角
        PassButton.layer.masksToBounds = true
        PassButton.layer.cornerRadius = 8.0
        //设置边框
        PassButton.layer.borderColor = UIColor.gray.cgColor
        PassButton.layer.borderWidth = 0.5
        
        self.contentView.addSubview(self.PassButton!)
        
        
        self.layoutView()
    }
    
    func layoutView() {
        
        self.NumberLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(0)
            make.left.equalTo(self.snp.left).offset(10)
            make.right.equalTo(self.snp.right).offset(-150)
            make.height.equalTo(40)
        }
        
        self.StateLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(0)
            make.left.equalTo(self.NumberLabel.snp.right).offset(0)
            make.right.equalTo(self.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        self.NameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.NumberLabel.snp.bottom).offset(0)
            make.left.equalTo(self.snp.left).offset(0)
            make.right.equalTo(self.snp.right).offset(0)
            make.height.equalTo(40)
        }
        
        self.TimeLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.NameLabel.snp.bottom).offset(0)
            make.left.equalTo(self.snp.left).offset(0)
            make.right.equalTo(self.snp.right).offset(0)
            make.height.equalTo(40)
        }
        
        

        self.PassButton.snp.makeConstraints { (make) in
            make.top.equalTo(self.TimeLabel.snp.bottom).offset(10)
            make.right.equalTo(self.snp.right).offset(-10)
            make.width.equalTo(70)
            make.height.equalTo(20)
        }
        
        
        
        
        
        
        
        
        
        
    }
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}

